<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>10-消息弹框组件</title>
    <!--Vue必须放上面-->
    <script src="../js/vue.js"></script>
    <!--ElementUi-->
    <script src="../element-ui/lib/index.js"></script>
    <link rel="stylesheet" href="../element-ui/lib/theme-chalk/index.css">
</head>
<body>
    <div id="app">
        <el-button type="primary" @click="fun" icon="el-icon-plus">登录</el-button>
        <el-dialog :visible.sync="flag">
            <!--传统的表单-->
            <form action="#">
                <p>
                    用户名<input type="text" name="username" placeholder="请输入用户名：" v-model="login.username">
                </p>
                <p>
                    密码<input type="password" name="password" placeholder="请输入密码："  v-model="login.password">
                </p>
                <p>
                    <input type="button" value="登录" @click="userLogin()">
                </p>
            </form>
        </el-dialog>
    </div>
    <script>
        const vm = new Vue({
            el: "#app",
            data: {
                flag:false,
                login:{
                    username:undefined,
                    password:undefined,
                }
            },
            methods: {
                fun:function () {
                    this.flag = true;
                },
                userLogin:function () {
                    // 向后台发送请求： 传递： login
                    this.flag=false;
                }
            }
        });
    </script>
</body>
</html>